import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JToolBar;
import java.awt.BorderLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JTree;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JSplitPane;
import javax.swing.JEditorPane;
import javax.swing.AbstractListModel;
import java.awt.Dimension;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.UIManager;
import javax.swing.ListSelectionModel;
import java.awt.SystemColor;
import java.awt.GridLayout;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JButton;
import javax.swing.JSeparator;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;


public class MyGui {

	private JFrame frmMyGui;
	private JTable nodeProperties;
	private JTable viewAttributes;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch (Throwable e) {
			e.printStackTrace();
		}
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MyGui window = new MyGui();
					window.frmMyGui.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public MyGui() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmMyGui = new JFrame();
		frmMyGui.setTitle("My GUi");
		frmMyGui.setBounds(100, 100, 660, 438);
		frmMyGui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JMenuBar menuBar = new JMenuBar();
		frmMyGui.setJMenuBar(menuBar);
		
		JMenu mnFile = new JMenu("File");
		menuBar.add(mnFile);
		
		JMenuItem mntmNew = new JMenuItem("New...");
		mnFile.add(mntmNew);
		
		JMenuItem mntmOpen = new JMenuItem("Open");
		mntmOpen.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				System.out.println("hello");
			}
		});
		mnFile.add(mntmOpen);
		
		JMenuItem mntmSaveAs = new JMenuItem("Save as...");
		mnFile.add(mntmSaveAs);
		
		JMenuItem mntmExit = new JMenuItem("Exit");
		mnFile.add(mntmExit);
		
		JMenu mnEdit = new JMenu("Edit");
		menuBar.add(mnEdit);
		
		JMenu mnHelp = new JMenu("Help");
		menuBar.add(mnHelp);
		
		JMenu mnAbout = new JMenu("About");
		menuBar.add(mnAbout);
		
		JPanel SouthPanel = new JPanel();
		frmMyGui.getContentPane().add(SouthPanel, BorderLayout.SOUTH);
		SouthPanel.setLayout(new BorderLayout(0, 0));
		
		JSplitPane splitPane_south = new JSplitPane();
		SouthPanel.add(splitPane_south);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setMaximumSize(new Dimension(0, 100));
		splitPane_south.setRightComponent(scrollPane);
		
		nodeProperties = new JTable();
		nodeProperties.setShowVerticalLines(true);
		nodeProperties.setShowHorizontalLines(true);
		nodeProperties.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
			},
			new String[] {
				"Property", "Value"
			}
		) {
			Class[] columnTypes = new Class[] {
				String.class, String.class
			};
			public Class getColumnClass(int columnIndex) {
				return columnTypes[columnIndex];
			}
		});
		nodeProperties.setPreferredScrollableViewportSize(new Dimension(100, 100));
		scrollPane.setViewportView(nodeProperties);
		
		JScrollPane scrollPane_1 = new JScrollPane();
		splitPane_south.setLeftComponent(scrollPane_1);
		
		viewAttributes = new JTable();
		viewAttributes.setShowHorizontalLines(true);
		viewAttributes.setShowVerticalLines(true);
		viewAttributes.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
			},
			new String[] {
				"Attribute", "Generate"
			}
		) {
			Class[] columnTypes = new Class[] {
				String.class, Boolean.class
			};
			public Class getColumnClass(int columnIndex) {
				return columnTypes[columnIndex];
			}
		});
		viewAttributes.setPreferredScrollableViewportSize(new Dimension(250, 100));
		scrollPane_1.setViewportView(viewAttributes);
		
		JSplitPane splitPane_middle = new JSplitPane();
		frmMyGui.getContentPane().add(splitPane_middle, BorderLayout.CENTER);
		
		JTree viewTree = new JTree();
		splitPane_middle.setLeftComponent(viewTree);
		
		JEditorPane editor = new JEditorPane();
		editor.setMaximumSize(new Dimension(0, 0));
		editor.setMinimumSize(new Dimension(0, 0));
		editor.setPreferredSize(new Dimension(400, 24));
		splitPane_middle.setRightComponent(editor);
		
		JToolBar toolBar = new JToolBar();
		frmMyGui.getContentPane().add(toolBar, BorderLayout.NORTH);
		
		JButton btnGenerate = new JButton("Generate");
		toolBar.add(btnGenerate);
		
		JButton btnGenerateMvp = new JButton("Generate MVP");
		toolBar.add(btnGenerateMvp);
	}

}
